package Lee_code;

import java.lang.reflect.Array;
import java.util.Arrays;
import java.util.HashSet;

public class Lee_220 {
    public boolean containsNearbyAlmostDuplicate(int[] nums, int indexDiff, int valueDiff) {
        Arrays.sort(nums);
        int fast = 1;
        int slow = 0;
        int sum = nums[slow];

        for(int i=0; i< nums.length-1; i++)
        {
            for(int j=i+1; (j-i)<=indexDiff && j< nums.length; j++)
            {
                if((nums[j] - nums[i]) <= valueDiff)
                    return true;
            }
        }

        return false;

    }
}
